package com.ky.pro.java.rpc.hd.dollar;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;

import java.util.Collections;

public class CodeGenerator {


    public static void main(String[] args) {

        String url = "jdbc:mysql://127.0.0.1:3306/exchange_b?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true";
        String ourDir = "D:\\workspace\\opt\\git\\ky\\pro-java\\09-RPC\\hmily-dubbo-demo\\hmily-dubbo-dollar-service\\src\\main";

        FastAutoGenerator.create(url, "root", "kevin123")
                .globalConfig(builder -> {
                    builder.author("Kevin Dummy") // 设置作者
                            .enableSwagger() // 开启 swagger 模式
                            .fileOverride() // 覆盖已生成文件
                            .outputDir(ourDir + "/java"); // 指定输出目录
                })
                .packageConfig(builder -> {
                    builder.parent("com.ky.pro.java.rpc.hd") // 设置父包名
                            .moduleName("dollar") // 设置父包模块名
                            .pathInfo(Collections.singletonMap(OutputFile.mapperXml, ourDir + "/resources/mapper")); // 设置mapperXml生成路径
                })
                .strategyConfig(builder -> builder.addInclude("t_account")
                        .addInclude("t_frozen_assets")
                        .addTablePrefix("t_")// 设置过滤表前缀
                        .entityBuilder().enableLombok())
                .execute();
    }

}
